package com.googlecode.afdbaccess.config.injectconfig;

import javax.annotation.PreDestroy;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;

import com.googlecode.afdbaccess.cache.TransactionAutoCommit;

@RequestScoped
public class ManagedRequestTransaction extends TransactionAutoCommit {
    //private final static Logger log = Logger.getLogger(ManagedRequestTransaction.class);

    protected ManagedRequestTransaction() {
        super();
    }
    
    @Inject
    protected ManagedRequestTransaction(InjectableCacheReferenceHolder cacheReferenceHolder) {
        super(cacheReferenceHolder.getDbCache());
    }
    
    @SuppressWarnings("unused")
    @PreDestroy
    private void autoClose() {
        //log.info("autoClose");
        super.close();
    }
}
